package com.sc.nft.dao;

import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.sc.nft.entity.FirstBuyRecord;
import com.sc.nft.entity.RushBuyRecord;
import com.sc.nft.mapper.RushBuyRecordMapper;
import lombok.extern.slf4j.Slf4j;
import org.springframework.stereotype.Repository;

import java.util.List;

/**
 * (sc_rush_buy_record)数据DAO
 *
 * @author Sun
 * @since 2022-08-19 11:31:21
 * @description 由 Mybatisplus Code Generator 创建
 */
@Slf4j
@Repository
public class RushBuyRecordDao extends ServiceImpl<RushBuyRecordMapper, RushBuyRecord> {

    public List<RushBuyRecord> getByProductIdAndCollectionUuid(Long productId, String collectionUuid) {
        LambdaQueryWrapper<RushBuyRecord> wrapper = new LambdaQueryWrapper<>();
        wrapper.eq(RushBuyRecord::getProductId,productId);
        wrapper.eq(RushBuyRecord::getCollectionUuid,collectionUuid);
        return list(wrapper);
    }

    public List<RushBuyRecord> getByProductIdAndUserId(Long productId, Long userId) {
        LambdaQueryWrapper<RushBuyRecord> wrapper = new LambdaQueryWrapper<>();
        wrapper.eq(RushBuyRecord::getProductId,productId);
        wrapper.eq(RushBuyRecord::getUserId,userId);
        wrapper.eq(RushBuyRecord::getType,2);
        return list(wrapper);
    }
}